/**
 * 
 */
package org.dailydev.mojo.birt.runner;

/**
 * @author bosakrom
 * 
 */
public class ModeEnum {

	private static final String RUNRENDER_VALUE = "runrender";
	private static final String RUN_VALUE = "run";
	private static final String RENDER_VALUE = "render";

	public static final ModeEnum RUNRENDER = new ModeEnum(RUNRENDER_VALUE);
	public static final ModeEnum RUN = new ModeEnum(RUN_VALUE);
	public static final ModeEnum RENDER = new ModeEnum(RENDER_VALUE);

	/**
	 * @param value
	 * @return
	 */
	public static ModeEnum fromValue(String value) {
		if (value == null) {
			throw new NullPointerException("Value can not be null");
		}
		ModeEnum[] literal = values();
		for (int i = 0; i < literal.length; i++) {
			if (literal[i].getValue().equalsIgnoreCase(value)) {
				return literal[i];
			}
		}
		throw new IllegalArgumentException("Illegal value for the enum> " + value);
	}

	/**
	 * @return
	 */
	public static ModeEnum[] values() {
		return new ModeEnum[] { RUNRENDER, RUN, RENDER };
	}

	private final String value;

	/**
	 * TODO Add description of this constructor
	 * 
	 * @param runrender_value2
	 */
	public ModeEnum(String value) {
		this.value = value;
	}

	/**
	 * Gets value of the enum literal
	 * 
	 * @return
	 */
	public String getValue() {
		return this.value;
	}

	/** {@inheritDoc} */
	public String toString() {
		return this.getValue();
	}

}
